<HTML>
<!-- =====================================================================

  File:      menu.htm for Adventure Works Cycles Storefront Sample
  Summary:   Self-documentation for application
  Date:	     June 16, 2003

=====================================================================

  This file is part of the Microsoft SQL Server Code Samples.
  Copyright (C) Microsoft Corporation.  All rights reserved.

This source code is intended only as a supplement to Microsoft
Development Tools and/or on-line documentation.  See these other
materials for detailed information regarding Microsoft code samples.

THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

======================================================= -->
    <head>
        <title>Adventure Works Cycles Store Documentation</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <BODY>
        <h1>
        Menu User Control
        </h1>
        <P>
            <strong>Description:</strong>&nbsp;The Menu user control displays a list of all product categories and subcategories within
        the Adventure Works Cycles database, and enables a user to easily navigate off to a product
        subcategory listing page that lists all of the actual products within that subcategory.&nbsp;
        </P>
        <p>
            <A href="UserControls.htm">
                <STRONG>Click here to learn more about what user controls are and how they are used within ASP.NET Web Applications</STRONG></A>
        <p>
            <strong>Implementation Notes:</strong>&nbsp;The Menu user control is used on almost every page within the Adventure Works Cycles application.
        <p>
            It's logic is encapsulated entirely within its&nbsp;<strong>Page_Load</strong>&nbsp; and <strong>OnPreRender</strong>&nbsp; event handlers.&nbsp; The Page_Load event handler is called when a page containing
        the Menu user control is accessed by a browser client.&nbsp;
        <p>
            <strong>Page_Load Event Handler:&nbsp;</strong>
            &nbsp;The Page_Load event handler creates an instance of the ProductDB class
            and calls its GetProductTree method. This method internally uses the
            <A href="usp_ProductCategoryList.htm">
            usp_ProductCategoryList</A>&nbsp;
        stored procedure to fetch the product categories and subcategories from the Adventure Works Cycles database.&nbsp;
        <p>
            The product category and subcategory collections are displayed using a tree server control.&nbsp; The tree server control contains an enbedded XML document which indicates how categories and subcategories should rendered.  In particular, the document specifies that selected subcategories be rendered differently from unselected nodes in the tree control.&nbsp;
        <p>
            The data values returned from the ProductsDB.GetProductTree() method are populated into the tree control by setting its&nbsp;<strong>TreeNodeSrc</strong>&nbsp;property, and then calling its&nbsp;<strong>DataBind()</strong>&nbsp;method.&nbsp; When DataBind() is called, the tree control will walk over
        the XML and render the categories and subcategories as a two level tree.
        <P>
            <b>Peformance Notes:</b>
            <ul>
                <li>
                The Menu user control support partial page output caching (a new ASP.NET 2.0 feature)
                to outputcache its results at 1 hour intervals.  This
                enables the application to avoid having to read the database on each request to
                a page containing this user control (dramatically improving performance).
                </li>
            </ul>
        <p>
        </p>
    </BODY>
</HTML>
